
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import {MatButtonModule} from '@angular/material/button';
import {
  MAT_DIALOG_DATA,
    MatDialogActions,
    MatDialogContent,
    MatDialogRef,
    MatDialogTitle,
  } from '@angular/material/dialog';

  @Component({
    templateUrl: './selfDialog.component.html',
    imports: [MatDialogActions, MatDialogTitle, MatDialogContent, MatButtonModule],
    changeDetection: ChangeDetectionStrategy.OnPush,
  })

  export class SelfDialogComponent {
    data = inject(MAT_DIALOG_DATA);
    readonly dialogRef = inject(MatDialogRef<SelfDialogComponent>);
    close(): void {
      this.data.fail && this.data.fail();
      this.dialogRef.close();
    }
    confirm(): void {
      this.data.success && this.data.success();
      this.dialogRef.close();
    }
  }